Elif Melisa Avcı - 2019402108
Doğa Yıldız - 2019402099
Zümra İnci - 2019402090
This project requires us to analyze a given dataset and observe any correlations between our statics and trends going on at the time. We started by choosing our stocks to analyze (AKBNK, CCOLA, FROTO, PGSUS, THYAO, VESTL). After that we plotted some boxplots in order to detect outliers. We used 3-sigma method while determining where to draw our limits. After that, we searched for relevant news and trends data with appropriate keywords for each outlier to see if there’s any connection between them. By the help of trends & web news, we were able to find some explanations for the outliers.
#importing our data & libraries
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
df = pd.read_csv(r"/Users/xxx/Desktop/modified_data.csv")
df.sort_values(by=['timestamp'])
#choosing 6 stocks
#print(df.columns.values)
#choose AKBNK,CCOLA,FROTO,PGSUS,THYAO,VESTL
#seeing if AKBNK has enough data
akbnk_timestampf = df.loc[df['AKBNK'].notna()]['timestamp'].iloc[0]
akbnk_timestampl = df.loc[df['AKBNK'].notna()]['timestamp'].iloc[-1]
print("akbnk start:",akbnk_timestampf)
print("akbnk finish:",akbnk_timestampl)
#seeing if CCOLA has enough data
ccola_timestampf = df.loc[df['CCOLA'].notna()]['timestamp'].iloc[0]
ccola_timestampl = df.loc[df['CCOLA'].notna()]['timestamp'].iloc[-1]
print("ccola start:",ccola_timestampf)
print("ccola finish:",ccola_timestampl)
#seeing if FROTO has enough data
froto_timestampf = df.loc[df['FROTO'].notna()]['timestamp'].iloc[0]
froto_timestampl = df.loc[df['FROTO'].notna()]['timestamp'].iloc[-1]
print("froto start:",froto_timestampf)
print("froto finish:",froto_timestampl)
#seeing if PGSUS has enough data
pgsus_timestampf = df.loc[df['PGSUS'].notna()]['timestamp'].iloc[0]
pgsus_timestampl = df.loc[df['PGSUS'].notna()]['timestamp'].iloc[-1]
print("pgsus start:",pgsus_timestampf)
print("pgsus finish:",pgsus_timestampl)
#seeing if THYAO has enough data
thyao_timestampf = df.loc[df['THYAO'].notna()]['timestamp'].iloc[0]
thyao_timestampl = df.loc[df['THYAO'].notna()]['timestamp'].iloc[-1]
print("thyao start:",thyao_timestampf)
print("thyao finish:",thyao_timestampl)
#seeing if VESTL has enough data
vestl_timestampf = df.loc[df['VESTL'].notna()]['timestamp'].iloc[0]
vestl_timestampl = df.loc[df['VESTL'].notna()]['timestamp'].iloc[-1]
print("vestl start:",vestl_timestampf)
print("vestl finish:",vestl_timestampl)
akbnk start: 2012-09-17 09:45:00 akbnk finish: 2019-07-23 18:00:00 ccola start: 2012-09-17 09:45:00 ccola finish: 2019-07-23 18:00:00 froto start: 2012-09-17 09:45:00 froto finish: 2019-07-23 18:00:00 pgsus start: 2013-04-26 09:30:00 pgsus finish: 2019-07-23 18:00:00 thyao start: 2012-09-17 09:45:00 thyao finish: 2019-07-23 18:00:00 vestl start: 2012-09-17 09:45:00 vestl finish: 2019-07-23 18:00:00
df['timestamp_2'] = pd.to_datetime(df['timestamp'])
df['year'] = df['timestamp_2'].dt.year
df['month'] = df['timestamp_2'].dt.month
df['day'] = df['timestamp_2'].dt.day
#chosen_indices = ['AKBNK', 'CCOLA', 'FROTO', 'PGSUS', 'THYAO', 'VESTL']
print(df)
timestamp AEFES AKBNK AKSA AKSEN ALARK ALBRK \
0 2012-09-17 09:45:00 22.3978 5.2084 1.7102 3.87 1.4683 1.1356
1 2012-09-17 10:00:00 22.3978 5.1938 1.7066 3.86 1.4574 1.1275
2 2012-09-17 10:15:00 22.3978 5.2084 1.7102 NaN 1.4610 1.1356
3 2012-09-17 10:30:00 22.3978 5.1938 1.7102 3.86 1.4537 1.1275
4 2012-09-17 10:45:00 22.5649 5.2084 1.7102 3.87 1.4574 1.1356
... ... ... ... ... ... ... ...
50007 2019-07-23 17:00:00 20.4800 7.7300 9.1400 2.47 3.2300 1.2100
50008 2019-07-23 17:15:00 20.5000 7.7200 9.1400 2.47 3.2200 1.2100
50009 2019-07-23 17:30:00 20.5000 7.7400 9.1300 2.46 3.2300 1.2100
50010 2019-07-23 17:45:00 20.4000 7.7000 9.1400 2.47 3.2400 1.2100
50011 2019-07-23 18:00:00 20.4600 7.7000 9.1400 2.47 3.2300 1.2000
ANACM ARCLK ASELS ... VAKBN VESTL YATAS YKBNK YUNSA \
0 1.0634 6.9909 2.9948 ... 3.8620 1.90 0.4172 2.5438 2.2619
1 1.0634 6.9259 2.9948 ... 3.8529 1.90 0.4229 2.5266 2.2462
2 1.0679 6.9909 2.9855 ... 3.8436 1.91 0.4229 2.5266 2.2566
3 1.0679 6.9584 2.9855 ... 3.8529 1.91 0.4286 2.5324 2.2619
4 1.0725 6.9909 2.9760 ... 3.8620 1.90 0.4286 2.5324 2.2619
... ... ... ... ... ... ... ... ... ...
50007 2.8400 20.3000 NaN ... 4.8600 9.98 5.3500 2.7500 4.2500
50008 2.8400 20.3200 NaN ... 4.8600 9.98 5.3400 2.7500 4.2400
50009 2.8300 20.3400 NaN ... 4.8600 9.96 5.3400 2.7600 4.2400
50010 2.8200 20.3800 NaN ... 4.8600 9.94 5.3400 2.7700 4.2400
50011 2.8300 20.3200 NaN ... 4.8500 9.93 5.3300 2.7700 4.2400
ZOREN timestamp_2 year month day
0 0.7789 2012-09-17 09:45:00 2012 9 17
1 0.7789 2012-09-17 10:00:00 2012 9 17
2 0.7789 2012-09-17 10:15:00 2012 9 17
3 0.7860 2012-09-17 10:30:00 2012 9 17
4 0.7789 2012-09-17 10:45:00 2012 9 17
... ... ... ... ... ...
50007 NaN 2019-07-23 17:00:00 2019 7 23
50008 NaN 2019-07-23 17:15:00 2019 7 23
50009 NaN 2019-07-23 17:30:00 2019 7 23
50010 NaN 2019-07-23 17:45:00 2019 7 23
50011 NaN 2019-07-23 18:00:00 2019 7 23
[50012 rows x 65 columns]
# List of companies
companies = ['AKBNK', 'CCOLA', 'FROTO', 'PGSUS', 'THYAO', 'VESTL']
# Loop through companies and months
for company in companies:
for year in range(2017, 2020): # We want to cover 3 years
for month in range(1, 13): # For all months
# Filter the data
company_data = df[(df['year'] == year) & (df['month'] == month)][[company]]
if not company_data.empty:
# Create a boxplot
plt.figure(figsize=(8, 6))
sns.boxplot(data=company_data, orient="v", color='lightblue')
plt.title(f'{company} Stock Prices in {month:02d}/{year}')
plt.ylabel(f'{company} Stock Price')
plt.show()
After plotting the box plots for each company, we determined that we can use alternative approach, 3-sigma.
# Define a multiplier for the 3-sigma rule
sigma_multiplier = 3
# Create a new column to flag outliers
for company in companies:
df[f'{company}_outlier'] = False # Initialize the column as False
for year in range(2017, 2020): # We want to cover 3 years
for month in range(1, 13): # For all months
# Filter the data for the specific company, year, and month
data_subset = df[(df['year'] == year) & (df['month'] == month)][[company]]
if not data_subset.empty:
# Calculate the mean and standard deviation for the subset
subset_mean = data_subset[company].mean()
subset_std = data_subset[company].std()
# Identify and flag outliers based on the 3-sigma rule
lower_bound = subset_mean - sigma_multiplier * subset_std
upper_bound = subset_mean + sigma_multiplier * subset_std
# Define the condition for which rows will be considered as outliers
outlier_condition = (
(df['year'] == year) &
(df['month'] == month) &
((df[company] < lower_bound) | (df[company] > upper_bound))
)
# Get the indices of rows that meet the outlier condition
outlier_indices = df.loc[outlier_condition].index
# Update the '_outlier' column to True for these indices
df.loc[outlier_indices, f'{company}_outlier'] = True
#df.loc[(df['year'] == year) & (df['month'] == month) & (
#(df[company] < lower_bound) | (df[company] > upper_bound)), f'{company}_outlier'] = True
# After running the loop, we will have a column for each company indicating whether each data point is an outlier.
# Extract the outliers
outliers_akbnk = df[df['AKBNK_outlier']]
outliers_ccola = df[df['CCOLA_outlier']]
outliers_froto = df[df['FROTO_outlier']]
outliers_pgsus = df[df['PGSUS_outlier']]
outliers_thyao = df[df['THYAO_outlier']]
outliers_vestl = df[df['VESTL_outlier']]
from IPython.display import display
Akbank_data = outliers_akbnk[['year', 'month', 'day', 'timestamp', 'AKBNK']]
display(Akbank_data)
| year | month | day | timestamp | AKBNK | |
|---|---|---|---|---|---|
| 30420 | 2017 | 1 | 31 | 2017-01-31 14:30:00 | 6.7643 |
| 30431 | 2017 | 1 | 31 | 2017-01-31 17:15:00 | 6.7643 |
| 30432 | 2017 | 1 | 31 | 2017-01-31 17:30:00 | 6.7803 |
| 30441 | 2017 | 2 | 1 | 2017-02-01 11:15:00 | 6.6681 |
| 30442 | 2017 | 2 | 1 | 2017-02-01 11:30:00 | 6.6521 |
| 31172 | 2017 | 3 | 6 | 2017-03-06 15:45:00 | 7.4375 |
| 31173 | 2017 | 3 | 6 | 2017-03-06 16:00:00 | 7.4375 |
| 31174 | 2017 | 3 | 6 | 2017-03-06 16:15:00 | 7.4375 |
| 31175 | 2017 | 3 | 6 | 2017-03-06 16:30:00 | 7.4375 |
| 31176 | 2017 | 3 | 6 | 2017-03-06 16:45:00 | 7.4294 |
| 31177 | 2017 | 3 | 6 | 2017-03-06 17:00:00 | 7.4294 |
| 31182 | 2017 | 3 | 7 | 2017-03-07 09:45:00 | 7.4535 |
| 31183 | 2017 | 3 | 7 | 2017-03-07 10:00:00 | 7.4294 |
| 31184 | 2017 | 3 | 7 | 2017-03-07 10:15:00 | 7.4615 |
| 31185 | 2017 | 3 | 7 | 2017-03-07 10:30:00 | 7.4375 |
| 31186 | 2017 | 3 | 7 | 2017-03-07 10:45:00 | 7.4455 |
| 35793 | 2017 | 10 | 9 | 2017-10-09 10:00:00 | 7.3946 |
| 35795 | 2017 | 10 | 9 | 2017-10-09 10:30:00 | 7.4357 |
| 35796 | 2017 | 10 | 9 | 2017-10-09 10:45:00 | 7.4439 |
| 35797 | 2017 | 10 | 9 | 2017-10-09 11:00:00 | 7.4357 |
| 35798 | 2017 | 10 | 9 | 2017-10-09 11:15:00 | 7.4192 |
| 35799 | 2017 | 10 | 9 | 2017-10-09 11:30:00 | 7.4275 |
| 35800 | 2017 | 10 | 9 | 2017-10-09 11:45:00 | 7.4192 |
| 35801 | 2017 | 10 | 9 | 2017-10-09 12:00:00 | 7.4275 |
| 35802 | 2017 | 10 | 9 | 2017-10-09 12:15:00 | 7.4357 |
| 35803 | 2017 | 10 | 9 | 2017-10-09 12:30:00 | 7.4604 |
| 41023 | 2018 | 6 | 1 | 2018-06-01 09:45:00 | 6.8976 |
| 44218 | 2018 | 11 | 1 | 2018-11-01 09:45:00 | 5.6451 |
| 44219 | 2018 | 11 | 1 | 2018-11-01 10:00:00 | 5.6365 |
| 44220 | 2018 | 11 | 1 | 2018-11-01 10:15:00 | 5.5679 |
| 44221 | 2018 | 11 | 1 | 2018-11-01 10:30:00 | 5.5507 |
| 44222 | 2018 | 11 | 1 | 2018-11-01 10:45:00 | 5.5679 |
| 44223 | 2018 | 11 | 1 | 2018-11-01 11:00:00 | 5.6193 |
| 44224 | 2018 | 11 | 1 | 2018-11-01 11:15:00 | 5.6365 |
| 44225 | 2018 | 11 | 1 | 2018-11-01 11:30:00 | 5.6536 |
| 44226 | 2018 | 11 | 1 | 2018-11-01 11:45:00 | 5.7309 |
| 44227 | 2018 | 11 | 1 | 2018-11-01 12:00:00 | 5.7223 |
| 44228 | 2018 | 11 | 1 | 2018-11-01 12:15:00 | 5.7309 |
| 44229 | 2018 | 11 | 1 | 2018-11-01 12:30:00 | 5.7394 |
| 44234 | 2018 | 11 | 1 | 2018-11-01 14:15:00 | 5.7394 |
| 44239 | 2018 | 11 | 1 | 2018-11-01 15:30:00 | 5.7309 |
| 44919 | 2018 | 12 | 3 | 2018-12-03 09:45:00 | 6.6831 |
| 44920 | 2018 | 12 | 3 | 2018-12-03 10:00:00 | 6.7003 |
| 44921 | 2018 | 12 | 3 | 2018-12-03 10:15:00 | 6.6831 |
| 44922 | 2018 | 12 | 3 | 2018-12-03 10:30:00 | 6.6917 |
| 44923 | 2018 | 12 | 3 | 2018-12-03 10:45:00 | 6.6746 |
| 44924 | 2018 | 12 | 3 | 2018-12-03 11:00:00 | 6.7089 |
| 44925 | 2018 | 12 | 3 | 2018-12-03 11:15:00 | 6.7175 |
| 44926 | 2018 | 12 | 3 | 2018-12-03 11:30:00 | 6.6746 |
| 44927 | 2018 | 12 | 3 | 2018-12-03 11:45:00 | 6.6574 |
| 44928 | 2018 | 12 | 3 | 2018-12-03 12:00:00 | 6.6402 |
| 44929 | 2018 | 12 | 3 | 2018-12-03 12:15:00 | 6.6488 |
| 44930 | 2018 | 12 | 3 | 2018-12-03 12:30:00 | 6.6574 |
| 44931 | 2018 | 12 | 3 | 2018-12-03 12:45:00 | 6.6488 |
| 44932 | 2018 | 12 | 3 | 2018-12-03 13:45:00 | 6.6317 |
# Filtering the data to include only dates between 2017 and 2019
filtered_df = df[(df['timestamp_2'] >= pd.to_datetime('2017-01-01')) &
(df['timestamp_2'] <= pd.to_datetime('2019-12-31'))]
# Plotting akbank's stock price trend with outliers for each month
company = 'AKBNK'
for year in range(2017, 2020): # Years 2017 to 2019
for month in range(1, 13): # Months January to December
monthly_data = filtered_df[(filtered_df['year'] == year) & (filtered_df['month'] == month)]
if not monthly_data.empty:
plt.figure(figsize=(10, 5))
plt.plot(monthly_data['timestamp_2'], monthly_data[company], label=f'{company} Stock Price', linestyle='-')
# Highlight outliers for the specific month
monthly_outliers = monthly_data[monthly_data[f'{company}_outlier']]
plt.scatter(monthly_outliers['timestamp_2'], monthly_outliers[company], color='red', label='Outliers', zorder=5)
plt.title(f'{company} Stock Price Trend - {year}-{month:02d}')
plt.xlabel('Date')
plt.ylabel('Stock Price')
plt.legend()
plt.show()
We used 3-sigma rule to determine the outliers for each month. We listed the outliers for each company on the table above. Then, we ploted the graphs for each month to determine if there is a decrease or increase in trend.
First of all, we looked at Google Trends data using a search keyword "Akbank hisse" to observe if there were similar patterns.
For the first outlier, which is at the end of January, beginning of February of 2017. We can see that there is peak on the search volume for "Akbank hisse" on same days. We also searched for some news and we found that Central Bank of Republic of Türkiye announced an increase in the interest rates at Jan, 24. (https://www.ntv.com.tr/ekonomi/merkez-bankasindan-faiz-karari,-imZnKSSuU28UfK77sEoZg)
At 6-7 March of 2017, there is also an increase in stock prices. The Google Trends data is also corralated with that stock prices. We can see that search volume started to increase from 5 March to 10 March and then it started to decrease as in stock prices.
At Oct 9, 2017, there is a decrease in stock prices, which is another outlier. We also observed that google search volume hit the bottom at that particular day as we can see from the chart below.
from IPython.display import display
ccola_data = outliers_ccola[['year', 'month', 'day', 'timestamp', 'CCOLA']]
display(ccola_data)
| year | month | day | timestamp | CCOLA | |
|---|---|---|---|---|---|
| 31099 | 2017 | 3 | 2 | 2017-03-02 12:30:00 | 32.0245 |
| 35793 | 2017 | 10 | 9 | 2017-10-09 10:00:00 | 33.1161 |
| 35794 | 2017 | 10 | 9 | 2017-10-09 10:15:00 | 33.1723 |
| 35797 | 2017 | 10 | 9 | 2017-10-09 11:00:00 | 33.2098 |
| 35798 | 2017 | 10 | 9 | 2017-10-09 11:15:00 | 33.1910 |
| 35799 | 2017 | 10 | 9 | 2017-10-09 11:30:00 | 33.2098 |
| 35801 | 2017 | 10 | 9 | 2017-10-09 12:00:00 | 33.2098 |
| 35807 | 2017 | 10 | 9 | 2017-10-09 14:00:00 | 33.1910 |
| 35808 | 2017 | 10 | 9 | 2017-10-09 14:15:00 | 33.1910 |
| 35809 | 2017 | 10 | 9 | 2017-10-09 14:30:00 | 33.1535 |
| 35810 | 2017 | 10 | 9 | 2017-10-09 14:45:00 | 33.1910 |
| 35811 | 2017 | 10 | 9 | 2017-10-09 15:00:00 | 33.1535 |
| 35812 | 2017 | 10 | 9 | 2017-10-09 15:15:00 | 33.1348 |
| 35814 | 2017 | 10 | 9 | 2017-10-09 15:45:00 | 33.1910 |
| 39634 | 2018 | 3 | 28 | 2018-03-28 17:15:00 | 32.8724 |
| 39669 | 2018 | 3 | 30 | 2018-03-30 09:45:00 | 37.1267 |
| 39934 | 2018 | 4 | 11 | 2018-04-11 14:15:00 | 31.9354 |
| 39935 | 2018 | 4 | 11 | 2018-04-11 14:30:00 | 31.8416 |
| 40489 | 2018 | 5 | 9 | 2018-05-09 09:45:00 | 31.4856 |
| 44330 | 2018 | 11 | 6 | 2018-11-06 14:30:00 | 29.4889 |
| 44510 | 2018 | 11 | 14 | 2018-11-14 11:30:00 | 24.6826 |
| 47603 | 2019 | 4 | 1 | 2019-04-01 09:45:00 | 29.0102 |
| 47604 | 2019 | 4 | 1 | 2019-04-01 10:00:00 | 28.8187 |
| 47605 | 2019 | 4 | 1 | 2019-04-01 10:15:00 | 28.9911 |
# Plotting coca cola's stock price trend with outliers for each month
company = 'CCOLA'
for year in range(2017, 2020): # Years 2017 to 2019
for month in range(1, 13): # Months January to December
monthly_data = filtered_df[(filtered_df['year'] == year) & (filtered_df['month'] == month)]
if not monthly_data.empty:
plt.figure(figsize=(10, 5))
plt.plot(monthly_data['timestamp_2'], monthly_data[company], label=f'{company} Stock Price', linestyle='-')
# Highlight outliers for the specific month
monthly_outliers = monthly_data[monthly_data[f'{company}_outlier']]
plt.scatter(monthly_outliers['timestamp_2'], monthly_outliers[company], color='red', label='Outliers', zorder=5)
plt.title(f'{company} Stock Price Trend - {year}-{month:02d}')
plt.xlabel('Date')
plt.ylabel('Stock Price')
plt.legend()
plt.show()
There is a decrease in stock prices on May 9, 2018, as well as a sudden decrease in Google Trends search keyword “coca cola hisse”.
On 14 November 2018, Morgan Stanley Capital International Turkey removed the stocks of six companies from the Turkish index including CCOLA. (https://tr.investing.com/news/world-news/borsazayf-kuresel-risk-istah-ve-baz-turk-sirket-hisselerinin-msci-endeksinden-ckarlmasyla-bist100-basklanabilir-541331, https://tr.investing.com/news/stock-market-news/msci-turkiye-endeksinden-alt-hisseyi-ckard-541315) This might be a possible reason behind the fall of stock prices on the same date. Also, there is a incline on Google Trends.
On April 1, 2019, a decline in CCOLA stock prices can be seen. This decline is not reflected on Google Search Trends, however, we found some news on the same exact date indicating that Coca Cola is entering the energy drink market, releasing the first energy drink under Coca-Cola brand. (https://www.warc.com/newsandopinion/news/coca-cola-launches-its-first-branded-energy-drink/en-gb/41877) This might be one possible reason of the decline in its stock prices.
from IPython.display import display
froto_data = outliers_froto[['year', 'month', 'day', 'timestamp', 'FROTO']]
display(froto_data)
| year | month | day | timestamp | FROTO | |
|---|---|---|---|---|---|
| 35568 | 2017 | 9 | 27 | 2017-09-27 16:45:00 | 37.3984 |
| 35570 | 2017 | 9 | 27 | 2017-09-27 17:15:00 | 37.3984 |
| 35571 | 2017 | 9 | 27 | 2017-09-27 17:30:00 | 37.3282 |
| 36519 | 2017 | 11 | 9 | 2017-11-09 10:30:00 | 52.1848 |
| 36520 | 2017 | 11 | 9 | 2017-11-09 10:45:00 | 51.8712 |
| 36521 | 2017 | 11 | 9 | 2017-11-09 11:00:00 | 51.7816 |
| 36522 | 2017 | 11 | 9 | 2017-11-09 11:15:00 | 51.7816 |
| 36536 | 2017 | 11 | 9 | 2017-11-09 15:15:00 | 51.7816 |
| 36537 | 2017 | 11 | 9 | 2017-11-09 15:30:00 | 51.7816 |
| 36538 | 2017 | 11 | 9 | 2017-11-09 15:45:00 | 51.7368 |
| 36543 | 2017 | 11 | 9 | 2017-11-09 17:00:00 | 51.7368 |
| 36544 | 2017 | 11 | 9 | 2017-11-09 17:15:00 | 51.7816 |
| 36546 | 2017 | 11 | 9 | 2017-11-09 17:45:00 | 51.8712 |
| 36547 | 2017 | 11 | 9 | 2017-11-09 18:00:00 | 52.2295 |
| 36548 | 2017 | 11 | 10 | 2017-11-10 09:45:00 | 52.2295 |
| 39607 | 2018 | 3 | 28 | 2018-03-28 10:00:00 | 59.2622 |
| 39608 | 2018 | 3 | 28 | 2018-03-28 10:15:00 | 59.3518 |
| 39609 | 2018 | 3 | 28 | 2018-03-28 10:30:00 | 59.3069 |
| 41476 | 2018 | 6 | 22 | 2018-06-22 17:45:00 | 64.9542 |
| 41478 | 2018 | 6 | 25 | 2018-06-25 09:45:00 | 65.1402 |
| 41479 | 2018 | 6 | 25 | 2018-06-25 10:00:00 | 65.4192 |
| 42881 | 2018 | 8 | 31 | 2018-08-31 15:15:00 | 61.0951 |
| 42882 | 2018 | 8 | 31 | 2018-08-31 15:30:00 | 61.0486 |
| 42884 | 2018 | 8 | 31 | 2018-08-31 16:00:00 | 61.8855 |
| 42885 | 2018 | 8 | 31 | 2018-08-31 16:15:00 | 63.9313 |
| 42886 | 2018 | 8 | 31 | 2018-08-31 16:30:00 | 64.3033 |
| 42887 | 2018 | 8 | 31 | 2018-08-31 16:45:00 | 64.9077 |
| 42888 | 2018 | 8 | 31 | 2018-08-31 17:00:00 | 63.7453 |
| 42889 | 2018 | 8 | 31 | 2018-08-31 17:15:00 | 63.2804 |
| 42890 | 2018 | 8 | 31 | 2018-08-31 17:30:00 | 62.6294 |
| 42891 | 2018 | 8 | 31 | 2018-08-31 17:45:00 | 62.2574 |
| 42892 | 2018 | 8 | 31 | 2018-08-31 18:00:00 | 62.2574 |
# Plotting ford's stock price trend with outliers for each month
company = 'FROTO'
for year in range(2017, 2020): # Years 2017 to 2019
for month in range(1, 13): # Months January to December
monthly_data = filtered_df[(filtered_df['year'] == year) & (filtered_df['month'] == month)]
if not monthly_data.empty:
plt.figure(figsize=(10, 5))
plt.plot(monthly_data['timestamp_2'], monthly_data[company], label=f'{company} Stock Price', linestyle='-')
# Highlight outliers for the specific month
monthly_outliers = monthly_data[monthly_data[f'{company}_outlier']]
plt.scatter(monthly_outliers['timestamp_2'], monthly_outliers[company], color='red', label='Outliers', zorder=5)
plt.title(f'{company} Stock Price Trend - {year}-{month:02d}')
plt.xlabel('Date')
plt.ylabel('Stock Price')
plt.legend()
plt.show()
There is a significant decrease at the end of September 2017. When we look at the google trends data, search volumes of "ford otosan bist" and "IST:FROTO" also decreased compared to the rest of the month.
After that decrease, the stock prices started to increase. At 9 November 2017, there is a peak, which is also an outlier data point. According to the news dated October 30, 2017, Ford Otosan's Q3 net profit increased by 98.9% to 345.9 million TL. (https://bigpara.hurriyet.com.tr/haberler/ekonomi-haberleri/ford-otosanin-k-ri-yuzde-989-artti_ID1441618/) After that news, the stock prices increased as we can see above.
Similar to the previous increase, we can attribute the increase in March to the news in this field. The total net profit of 8 companies operating in the automotive sector in Borsa Istanbul increased by 31.7 percent compared to the previous year, reaching 3.3 billion lira. (https://www.aa.com.tr/tr/ekonomi/borsada-otomotiv-sirketlerinin-toplam-kari-3-milyar-lirayi-asti/1092310) That news dated March 18, can lead to an increase in the stock prices at the following days.
On June 20, 2018, the merger of Volkswagen and Ford was officially announced. It was announced that the work would proceed by sharing the technology, infrastructure and development costs of large projects. (https://www.donanimhaber.com/Volkswagen-ve-Ford-gelecek-icin-guclerini-birlestirdi--100777) We can say that this news also increased share prices. This increase peaked on 22nd and 25th of the June.
from IPython.display import display
pgsus_data = outliers_pgsus[['year', 'month', 'day', 'timestamp', 'PGSUS']]
pd.set_option('display.max_rows', None)
display(pgsus_data)
| year | month | day | timestamp | PGSUS | |
|---|---|---|---|---|---|
| 31030 | 2017 | 2 | 28 | 2017-02-28 10:45:00 | 15.25 |
| 31031 | 2017 | 2 | 28 | 2017-02-28 11:00:00 | 15.26 |
| 31032 | 2017 | 2 | 28 | 2017-02-28 11:15:00 | 15.25 |
| 31033 | 2017 | 2 | 28 | 2017-02-28 11:30:00 | 15.23 |
| 31034 | 2017 | 2 | 28 | 2017-02-28 11:45:00 | 15.24 |
| 31035 | 2017 | 2 | 28 | 2017-02-28 12:00:00 | 15.26 |
| 31036 | 2017 | 2 | 28 | 2017-02-28 12:15:00 | 15.24 |
| 31037 | 2017 | 2 | 28 | 2017-02-28 12:30:00 | 15.26 |
| 31040 | 2017 | 2 | 28 | 2017-02-28 14:00:00 | 15.26 |
| 31041 | 2017 | 2 | 28 | 2017-02-28 14:15:00 | 15.26 |
| 31042 | 2017 | 2 | 28 | 2017-02-28 14:30:00 | 15.24 |
| 31043 | 2017 | 2 | 28 | 2017-02-28 14:45:00 | 15.23 |
| 31044 | 2017 | 2 | 28 | 2017-02-28 15:00:00 | 15.22 |
| 31045 | 2017 | 2 | 28 | 2017-02-28 15:15:00 | 15.16 |
| 31046 | 2017 | 2 | 28 | 2017-02-28 15:30:00 | 15.10 |
| 31047 | 2017 | 2 | 28 | 2017-02-28 15:45:00 | 15.06 |
| 31048 | 2017 | 2 | 28 | 2017-02-28 16:00:00 | 15.12 |
| 31049 | 2017 | 2 | 28 | 2017-02-28 16:15:00 | 15.16 |
| 31050 | 2017 | 2 | 28 | 2017-02-28 16:30:00 | 15.19 |
| 31051 | 2017 | 2 | 28 | 2017-02-28 16:45:00 | 15.21 |
| 31052 | 2017 | 2 | 28 | 2017-02-28 17:00:00 | 15.18 |
| 31053 | 2017 | 2 | 28 | 2017-02-28 17:15:00 | 15.18 |
| 31054 | 2017 | 2 | 28 | 2017-02-28 17:30:00 | 15.14 |
| 31055 | 2017 | 2 | 28 | 2017-02-28 17:45:00 | 15.15 |
| 31056 | 2017 | 2 | 28 | 2017-02-28 18:00:00 | 15.16 |
| 40863 | 2018 | 5 | 24 | 2018-05-24 17:30:00 | 24.16 |
| 40864 | 2018 | 5 | 24 | 2018-05-24 17:45:00 | 23.86 |
| 40865 | 2018 | 5 | 24 | 2018-05-24 18:00:00 | 23.86 |
| 40866 | 2018 | 5 | 25 | 2018-05-25 09:45:00 | 24.04 |
| 40867 | 2018 | 5 | 25 | 2018-05-25 10:00:00 | 23.86 |
| 40868 | 2018 | 5 | 25 | 2018-05-25 10:15:00 | 24.06 |
| 40869 | 2018 | 5 | 25 | 2018-05-25 10:30:00 | 24.10 |
| 40870 | 2018 | 5 | 25 | 2018-05-25 10:45:00 | 24.10 |
| 40871 | 2018 | 5 | 25 | 2018-05-25 11:00:00 | 23.96 |
| 40872 | 2018 | 5 | 25 | 2018-05-25 11:15:00 | 24.04 |
| 40873 | 2018 | 5 | 25 | 2018-05-25 11:30:00 | 24.08 |
| 40874 | 2018 | 5 | 25 | 2018-05-25 11:45:00 | 24.16 |
| 40875 | 2018 | 5 | 25 | 2018-05-25 12:00:00 | 24.04 |
| 40876 | 2018 | 5 | 25 | 2018-05-25 12:15:00 | 23.88 |
| 40877 | 2018 | 5 | 25 | 2018-05-25 12:30:00 | 23.82 |
| 40878 | 2018 | 5 | 25 | 2018-05-25 12:45:00 | 23.72 |
| 40880 | 2018 | 5 | 25 | 2018-05-25 13:45:00 | 23.72 |
| 40881 | 2018 | 5 | 25 | 2018-05-25 14:00:00 | 23.76 |
| 40882 | 2018 | 5 | 25 | 2018-05-25 14:15:00 | 23.94 |
| 40883 | 2018 | 5 | 25 | 2018-05-25 14:30:00 | 24.02 |
| 42893 | 2018 | 9 | 3 | 2018-09-03 09:45:00 | 23.80 |
| 42894 | 2018 | 9 | 3 | 2018-09-03 10:00:00 | 24.38 |
| 42895 | 2018 | 9 | 3 | 2018-09-03 10:15:00 | 24.46 |
| 47604 | 2019 | 4 | 1 | 2019-04-01 10:00:00 | 26.88 |
| 47605 | 2019 | 4 | 1 | 2019-04-01 10:15:00 | 26.70 |
| 47606 | 2019 | 4 | 1 | 2019-04-01 10:30:00 | 26.84 |
| 47607 | 2019 | 4 | 1 | 2019-04-01 10:45:00 | 27.04 |
| 47608 | 2019 | 4 | 1 | 2019-04-01 11:00:00 | 27.00 |
| 48963 | 2019 | 5 | 31 | 2019-05-31 14:45:00 | 34.50 |
| 48964 | 2019 | 5 | 31 | 2019-05-31 15:00:00 | 34.92 |
| 48965 | 2019 | 5 | 31 | 2019-05-31 15:15:00 | 35.10 |
| 48966 | 2019 | 5 | 31 | 2019-05-31 15:30:00 | 35.20 |
| 48967 | 2019 | 5 | 31 | 2019-05-31 15:45:00 | 35.02 |
| 48968 | 2019 | 5 | 31 | 2019-05-31 16:00:00 | 34.98 |
| 48969 | 2019 | 5 | 31 | 2019-05-31 16:15:00 | 34.84 |
| 48970 | 2019 | 5 | 31 | 2019-05-31 16:30:00 | 34.82 |
| 48971 | 2019 | 5 | 31 | 2019-05-31 16:45:00 | 34.88 |
| 48972 | 2019 | 5 | 31 | 2019-05-31 17:00:00 | 34.82 |
| 48973 | 2019 | 5 | 31 | 2019-05-31 17:15:00 | 34.78 |
| 48974 | 2019 | 5 | 31 | 2019-05-31 17:30:00 | 35.10 |
| 48975 | 2019 | 5 | 31 | 2019-05-31 17:45:00 | 35.22 |
| 48976 | 2019 | 5 | 31 | 2019-05-31 18:00:00 | 35.20 |
# Plotting pegasus's stock price trend with outliers for each month
company = 'PGSUS'
for year in range(2017, 2020): # Years 2017 to 2019
for month in range(1, 13): # Months January to December
monthly_data = filtered_df[(filtered_df['year'] == year) & (filtered_df['month'] == month)]
if not monthly_data.empty:
plt.figure(figsize=(10, 5))
plt.plot(monthly_data['timestamp_2'], monthly_data[company], label=f'{company} Stock Price', linestyle='-')
# Highlight outliers for the specific month
monthly_outliers = monthly_data[monthly_data[f'{company}_outlier']]
plt.scatter(monthly_outliers['timestamp_2'], monthly_outliers[company], color='red', label='Outliers', zorder=5)
plt.title(f'{company} Stock Price Trend - {year}-{month:02d}')
plt.xlabel('Date')
plt.ylabel('Stock Price')
plt.legend()
plt.show()
There is a sharp decline in Pegasus share prices towards the end of February. When we look at the period news, we see that two of THY's planes broke down in similar periods. These malfunctions at THY may have affected the airline industry. (THY plane made a forced landing in the USA: https://www.aa.com.tr/tr/dunya/thy-ucagi-abdye-zorunlu-inis-yapti/757937 & THY plane was evacuated because of the bomb note in the toilet: https://www.sozcu.com.tr/2017/gundem/thy-ucagi-tuvaletteki-bomba-notu-yuzunden-bosaltildi-1687310/) Additionally, we can see a significant increase in the google searches of plane accidents. We can say that these accidents. It may influenced the stock prices since both Pegasus and THY are in the same sector.
There is a decline in PGSUS stock prices on 24-25th April, 2018. There is not a significant correlation between trends data & stock prices. But, there is news about the verdict of the broken plane, which may have caused stocks to drop. (https://www.cumhuriyet.com.tr/haber/pistten-cikan-ucak-hakkinda-karar-verildi-982037)
There is a decline in PGSUS stock prices on 3rd September, 2018. There is not a significant correlation between trends data & stock prices. There is news about the unpleasant experience of a passenger, and the verdict of it. This may have caused stocks to drop. (https://www.diken.com.tr/emsal-olabilir-pegasus-ucakta-onuru-kirilan-yolcuya-tazminat-odeyecek/)
There is a peak in PGSUS stock prices on 31th May, 2019. We can see that the Ramadan Holiday started in 31.05.2019 and there were much more flights than usual. (https://www.aa.com.tr/tr/turkiye/sabiha-gokcen-havalimaninda-bayram-tatili-yogunlugu-/1493061#) This could be a potential reason for the sudden peak of PGSUS stocks. Also, there is an increase in Google Trends for the keyword "pegasus hisse".
We can also see that there is news about PGSUS stocks, which are traded under BIST 100. https://tr.investing.com/news/stock-market-news/turkiye-piyasalar-kapansta-yukseldi-bist-100-324-deger-kazand-571783
from IPython.display import display
thyao_data = outliers_thyao[['year', 'month', 'day', 'timestamp', 'THYAO']]
display(thyao_data)
| year | month | day | timestamp | THYAO | |
|---|---|---|---|---|---|
| 31045 | 2017 | 2 | 28 | 2017-02-28 15:15:00 | 5.46 |
| 31046 | 2017 | 2 | 28 | 2017-02-28 15:30:00 | 5.45 |
| 31047 | 2017 | 2 | 28 | 2017-02-28 15:45:00 | 5.42 |
| 31048 | 2017 | 2 | 28 | 2017-02-28 16:00:00 | 5.42 |
| 31049 | 2017 | 2 | 28 | 2017-02-28 16:15:00 | 5.44 |
| 31050 | 2017 | 2 | 28 | 2017-02-28 16:30:00 | 5.46 |
| 31051 | 2017 | 2 | 28 | 2017-02-28 16:45:00 | 5.45 |
| 31052 | 2017 | 2 | 28 | 2017-02-28 17:00:00 | 5.46 |
| 31053 | 2017 | 2 | 28 | 2017-02-28 17:15:00 | 5.46 |
| 31054 | 2017 | 2 | 28 | 2017-02-28 17:30:00 | 5.45 |
| 31055 | 2017 | 2 | 28 | 2017-02-28 17:45:00 | 5.45 |
| 31056 | 2017 | 2 | 28 | 2017-02-28 18:00:00 | 5.46 |
| 42723 | 2018 | 8 | 17 | 2018-08-17 10:15:00 | 14.65 |
| 42724 | 2018 | 8 | 17 | 2018-08-17 10:30:00 | 14.35 |
| 42725 | 2018 | 8 | 17 | 2018-08-17 10:45:00 | 14.48 |
| 42727 | 2018 | 8 | 17 | 2018-08-17 11:15:00 | 14.67 |
| 42728 | 2018 | 8 | 17 | 2018-08-17 11:30:00 | 14.62 |
| 42729 | 2018 | 8 | 17 | 2018-08-17 11:45:00 | 14.57 |
| 42730 | 2018 | 8 | 17 | 2018-08-17 12:00:00 | 14.60 |
| 42731 | 2018 | 8 | 17 | 2018-08-17 12:15:00 | 14.52 |
| 42732 | 2018 | 8 | 17 | 2018-08-17 12:30:00 | 14.58 |
| 42733 | 2018 | 8 | 17 | 2018-08-17 12:45:00 | 14.57 |
| 42735 | 2018 | 8 | 17 | 2018-08-17 13:45:00 | 14.59 |
| 47604 | 2019 | 4 | 1 | 2019-04-01 10:00:00 | 12.62 |
| 47605 | 2019 | 4 | 1 | 2019-04-01 10:15:00 | 12.60 |
| 47606 | 2019 | 4 | 1 | 2019-04-01 10:30:00 | 12.70 |
# Plotting thy's stock price trend with outliers for each month
company = 'THYAO'
for year in range(2017, 2020): # Years 2017 to 2019
for month in range(1, 13): # Months January to December
monthly_data = filtered_df[(filtered_df['year'] == year) & (filtered_df['month'] == month)]
if not monthly_data.empty:
plt.figure(figsize=(10, 5))
plt.plot(monthly_data['timestamp_2'], monthly_data[company], label=f'{company} Stock Price', linestyle='-')
# Highlight outliers for the specific month
monthly_outliers = monthly_data[monthly_data[f'{company}_outlier']]
plt.scatter(monthly_outliers['timestamp_2'], monthly_outliers[company], color='red', label='Outliers', zorder=5)
plt.title(f'{company} Stock Price Trend - {year}-{month:02d}')
plt.xlabel('Date')
plt.ylabel('Stock Price')
plt.legend()
plt.show()
The decrease in stock prices can be also observed in THY at the end of february like Pegasus. As I mentioned before, two of THY's planes broke down in the second half of February. These malfunctions at THY may have affected the airline industry. (THY plane made a forced landing in the USA: https://www.aa.com.tr/tr/dunya/thy-ucagi-abdye-zorunlu-inis-yapti/757937 & THY plane was evacuated because of the bomb note in the toilet: https://www.sozcu.com.tr/2017/gundem/thy-ucagi-tuvaletteki-bomba-notu-yuzunden-bosaltildi-1687310/) Additionally, THY announced a loss of 6.5 billion lira on February 16. (https://www.turizmguncel.com/haber/thy-65-milyar-lira-zarar-acikladi-chp-arastirma-onergesi-verdi-h30666.html) The effect of this new may additionally reduce stock prices.
There is a significant decrease at August 17, 2018. A campaign not to advertise to US companies was launched, and THY announced its participation in the campaign on August 14. (https://tr.investing.com/news/stock-market-news/abdli-sirketlere-reklam-vermeme-kampanyas-baslatld-thy-ve-turk-telekom-kampanyaya-katldgn-duyurdu-531267) It was stated that with the campaign, organizations that advertise on FOX TV, Google, Facebook, YouTube, Twitter and Instagram were warned and the advertisers were given the message "Stay with Turkey in the economic war". With this statement, the change in marketing strategy at THY may have reduced stock prices.
from IPython.display import display
vestl_data = outliers_vestl[['year', 'month', 'day', 'timestamp', 'VESTL']]
display(vestl_data)
| year | month | day | timestamp | VESTL | |
|---|---|---|---|---|---|
| 30208 | 2017 | 1 | 20 | 2017-01-20 16:30:00 | 7.05 |
| 30209 | 2017 | 1 | 20 | 2017-01-20 16:45:00 | 7.05 |
| 30210 | 2017 | 1 | 20 | 2017-01-20 17:00:00 | 7.04 |
| 30212 | 2017 | 1 | 20 | 2017-01-20 17:30:00 | 7.03 |
| 30213 | 2017 | 1 | 20 | 2017-01-20 17:45:00 | 7.12 |
| 30214 | 2017 | 1 | 20 | 2017-01-20 18:00:00 | 7.09 |
| 30215 | 2017 | 1 | 23 | 2017-01-23 09:45:00 | 7.13 |
| 30216 | 2017 | 1 | 23 | 2017-01-23 10:00:00 | 7.14 |
| 30217 | 2017 | 1 | 23 | 2017-01-23 10:15:00 | 7.03 |
| 30218 | 2017 | 1 | 23 | 2017-01-23 10:30:00 | 7.08 |
| 30219 | 2017 | 1 | 23 | 2017-01-23 10:45:00 | 7.10 |
| 32419 | 2017 | 5 | 2 | 2017-05-02 11:45:00 | 7.39 |
| 32420 | 2017 | 5 | 2 | 2017-05-02 12:00:00 | 7.41 |
| 32421 | 2017 | 5 | 2 | 2017-05-02 12:15:00 | 7.40 |
| 32422 | 2017 | 5 | 2 | 2017-05-02 12:30:00 | 7.41 |
| 32423 | 2017 | 5 | 2 | 2017-05-02 12:45:00 | 7.41 |
| 32425 | 2017 | 5 | 2 | 2017-05-02 13:45:00 | 7.41 |
| 32426 | 2017 | 5 | 2 | 2017-05-02 14:00:00 | 7.42 |
| 32427 | 2017 | 5 | 2 | 2017-05-02 14:15:00 | 7.40 |
| 32431 | 2017 | 5 | 2 | 2017-05-02 15:15:00 | 7.39 |
| 36313 | 2017 | 10 | 31 | 2017-10-31 14:30:00 | 9.15 |
| 36314 | 2017 | 10 | 31 | 2017-10-31 14:45:00 | 9.12 |
| 36315 | 2017 | 10 | 31 | 2017-10-31 15:00:00 | 9.10 |
| 36316 | 2017 | 10 | 31 | 2017-10-31 15:15:00 | 9.08 |
| 36317 | 2017 | 10 | 31 | 2017-10-31 15:30:00 | 9.10 |
| 36318 | 2017 | 10 | 31 | 2017-10-31 15:45:00 | 9.21 |
| 36319 | 2017 | 10 | 31 | 2017-10-31 16:00:00 | 9.38 |
| 36320 | 2017 | 10 | 31 | 2017-10-31 16:15:00 | 9.40 |
| 36321 | 2017 | 10 | 31 | 2017-10-31 16:30:00 | 9.65 |
| 36322 | 2017 | 10 | 31 | 2017-10-31 16:45:00 | 9.86 |
| 36323 | 2017 | 10 | 31 | 2017-10-31 17:00:00 | 9.92 |
| 36324 | 2017 | 10 | 31 | 2017-10-31 17:15:00 | 9.96 |
| 36325 | 2017 | 10 | 31 | 2017-10-31 17:30:00 | 9.90 |
| 36326 | 2017 | 10 | 31 | 2017-10-31 17:45:00 | 9.86 |
| 36327 | 2017 | 10 | 31 | 2017-10-31 18:00:00 | 9.88 |
| 36338 | 2017 | 11 | 1 | 2017-11-01 12:15:00 | 11.68 |
| 36343 | 2017 | 11 | 1 | 2017-11-01 14:00:00 | 11.61 |
| 37685 | 2018 | 1 | 2 | 2018-01-02 09:45:00 | 7.61 |
| 37686 | 2018 | 1 | 2 | 2018-01-02 10:00:00 | 7.64 |
| 37687 | 2018 | 1 | 2 | 2018-01-02 10:15:00 | 7.81 |
| 37688 | 2018 | 1 | 2 | 2018-01-02 10:30:00 | 7.86 |
| 37689 | 2018 | 1 | 2 | 2018-01-02 10:45:00 | 7.83 |
| 37690 | 2018 | 1 | 2 | 2018-01-02 11:00:00 | 7.88 |
| 38923 | 2018 | 2 | 26 | 2018-02-26 11:30:00 | 11.78 |
| 38924 | 2018 | 2 | 26 | 2018-02-26 11:45:00 | 11.69 |
| 38925 | 2018 | 2 | 26 | 2018-02-26 12:00:00 | 11.67 |
| 38926 | 2018 | 2 | 26 | 2018-02-26 12:15:00 | 11.65 |
| 38927 | 2018 | 2 | 26 | 2018-02-26 12:30:00 | 11.65 |
| 38928 | 2018 | 2 | 26 | 2018-02-26 12:45:00 | 11.68 |
| 38929 | 2018 | 2 | 26 | 2018-02-26 13:45:00 | 11.68 |
| 38930 | 2018 | 2 | 26 | 2018-02-26 14:00:00 | 11.83 |
| 38931 | 2018 | 2 | 26 | 2018-02-26 14:15:00 | 11.73 |
| 38932 | 2018 | 2 | 26 | 2018-02-26 14:30:00 | 11.62 |
| 38944 | 2018 | 2 | 26 | 2018-02-26 17:30:00 | 11.66 |
| 38945 | 2018 | 2 | 26 | 2018-02-26 17:45:00 | 11.75 |
| 38946 | 2018 | 2 | 26 | 2018-02-26 18:00:00 | 11.77 |
| 38947 | 2018 | 2 | 27 | 2018-02-27 09:45:00 | 11.67 |
| 46902 | 2019 | 2 | 28 | 2019-02-28 10:30:00 | 11.08 |
| 46903 | 2019 | 2 | 28 | 2019-02-28 10:45:00 | 10.85 |
# Plotting vestel's stock price trend with outliers for each month
company = 'VESTL'
for year in range(2017, 2020): # Years 2017 to 2019
for month in range(1, 13): # Months January to December
monthly_data = filtered_df[(filtered_df['year'] == year) & (filtered_df['month'] == month)]
if not monthly_data.empty:
plt.figure(figsize=(10, 5))
plt.plot(monthly_data['timestamp_2'], monthly_data[company], label=f'{company} Stock Price', linestyle='-')
# Highlight outliers for the specific month
monthly_outliers = monthly_data[monthly_data[f'{company}_outlier']]
plt.scatter(monthly_outliers['timestamp_2'], monthly_outliers[company], color='red', label='Outliers', zorder=5)
plt.title(f'{company} Stock Price Trend - {year}-{month:02d}')
plt.xlabel('Date')
plt.ylabel('Stock Price')
plt.legend()
plt.show()
There is an increase in stock prices on 20 January 2017. There is a slight increase on Google Trends data as well. Also, it is said that Vestel Elektronik, traded under BIST 100, showed the best performance of the session in some news. (https://tr.investing.com/news/stock-market-news/turkiye-piyasalar-kapansta-yukseldi-bist-100-093-deger-kazand-123587)
There is not a significant correlation between stock prices and Google Trends for the outlier on 2 May 2017. There is some news indicating that The championship match of the volleyball league organized by Vestel Venus was held on that day. (https://www.aa.com.tr/tr/gunun-basliklari/filede-sampiyon-fenerbahce/809899#) This may be a possible reason for the increase.
At the end of October and beginning of November 2017, companies that will produce domestic automobiles have been announced, including Vestel. (https://www.cnnturk.com/otomobil/yerli-otomobili-uretecek-firmalar-belli-oldu) This seems like strong evidence behind the increase on that day. This can also be seen from Google Trends search keywords “vestel hisse” and “yerli araba”.
There is an increase in stock prices on 2 January 2018. There is a significant increase on Google Trends data as well.
There are several outliers on 26, 27 and 28 February 2018. This also aligns with Google Trends. One possible reason for these peaks is that it is announced on the same day that Zorlu Holding has partnered with Chinese GSR, and with this partnership, it will start producing batteries to be used in electric vehicles with an investment of 4.5 billion dollars. (https://www.sozcu.com.tr/2018/ekonomi/zorlu-holding-cinli-gsr-ile-batarya-uretecek-2247943/)
ChatGPT Large Language Model
Prompt: For the outliers, I want to indicate potential reasons, possibly through preliminary research or a solid understanding of market dynamics. For this, I will use Google Trends to probe for events or relevant news coinciding with the dates of the detected outliers in the indices. Then I will plot the line plot of the search volume and the data I obtained for each month. Note that I need to provide these plots for each measure of interest. I can also provide the scatter plot of the search volume and measure of interest to understand if there is a relationship between them. Can you determine search keywords that can be relevant to the prices (i.e. if you are interested in AKBNK you can check the search volume for “IST:AKBNK”)? Our selected stokcs are: AKBNK VESTL FROTO THYAO PGSUS CCOLA
Answer: For tracking potential reasons behind stock price movements through Google Trends, you can consider using a combination of the company's stock ticker, the company's name, and potentially broader economic or industry-related terms that might influence stock prices. Here are some keyword suggestions for each company: AKBNK (Akbank) "IST:AKBNK" "Akbank stock" "Akbank news" "Turkey banking sector" VESTL (Vestel) "IST:VESTL" "Vestel stock" "Vestel news" "Turkey electronics market" FROTO (Ford Otosan) "IST:FROTO" "Ford Otosan stock" "Ford Otosan news" "Turkey automotive industry" THYAO (Turkish Airlines) "IST:THYAO" "Turkish Airlines stock" "Turkish Airlines news" "Turkey aviation industry" PGSUS (Pegasus Airlines) "IST:PGSUS" "Pegasus Airlines stock" "Pegasus Airlines news" "Turkey air travel" CCOLA (Coca-Cola İçecek) "IST:CCOLA" "Coca-Cola İçecek stock" "Coca-Cola İçecek news" "Beverage industry in Turkey" For each of these keywords, you can use Google Trends to see the relative search volume over time and correlate these with the dates of the outliers detected in the stock data. This might help you pinpoint whether there was increased public interest or concern regarding a company at the same time as significant price movements, which could suggest that market-relevant events or news were influencing stock prices.
Prompt: I have to plot the Google Trends data for each month, and also for each search keyword. You can use "THY hisse" and "THY borsa" as search keys. Is there a library to do this in Python like an integration? We are interested in the results in Turkey, so the language is Turkish.
Answer: Yes, there is a Python library called pytrends that allows you to interface with Google Trends data. To use pytrends to get data for specific search terms over a given time period, you would first need to install the library using pip if you haven't already:
pip install pytrends
Here's an example of how you might use pytrends to retrieve Google Trends data for the terms "THY hisse" and "THY borsa" and plot them:
from pytrends.request import TrendReq import pandas as pd import matplotlib.pyplot as plt
pytrend = TrendReq(hl='tr-TR')
keywords = ["THY hisse", "THY borsa"]
timeframe = '2017-01-01 2019-12-31'
pytrend.build_payload(kw_list=keywords, timeframe=timeframe, geo='TR') interest_over_time_df = pytrend.interest_over_time()
plt.figure(figsize=(15, 5)) for keyword in keywords: plt.plot(interest_over_time_df.index, interest_over_time_df[keyword], label=keyword)
plt.title('Google Search Trends') plt.xlabel('Date') plt.ylabel('Interest Over Time') plt.legend() plt.show()
This code will plot the relative search interest for "THY hisse" and "THY borsa" in Turkey from January 2017 to December 2019.
Remember that the values returned by Google Trends are relative to the highest point on the chart for the given region and time. A value of 100 is the peak popularity for the term, and a value of 50 means that the term is half as popular. Consequently, these numbers can help identify trends but are not absolute search volume numbers.
Prompt: Jupyter notebook does not display all rows. How can I fix this?
Answer: pd.set_option('display.max_rows', None)
Prompt: AEFES' 'AKBNK' 'AKSA' 'AKSEN' 'ALARK' 'ALBRK' 'ANACM' 'ARCLK' 'ASELS' 'ASUZU' 'AYGAZ' 'BAGFS' 'BANVT' 'BRISA' 'CCOLA' 'CEMAS' 'ECILC' 'EREGL' 'FROTO' 'GARAN' 'GOODY' 'GUBRF' 'HALKB' 'ICBCT' 'ISCTR' 'ISDMR' 'ISFIN' 'ISYAT' 'KAREL' 'KARSN' 'KCHOL' 'KRDMB' 'KRDMD' 'MGROS' 'OTKAR' 'PARSN' 'PETKM' 'PGSUS' 'PRKME' 'SAHOL' 'SASA' 'SISE' 'SKBNK' 'SODA' 'TCELL' 'THYAO' 'TKFEN' 'TOASO' 'TRKCM' 'TSKB' 'TTKOM' 'TUKAS' 'TUPRS' 'USAK' 'VAKBN' 'VESTL' 'YATAS' 'YKBNK' 'YUNSA' 'ZOREN which companies are these values for in borsa istanbul
Answer: The values you've provided appear to be stock ticker symbols for companies listed on Borsa İstanbul (BIST), the stock exchange in Istanbul, Turkey. Each ticker symbol represents a specific company or entity whose shares are traded on the exchange.
Here is the list of the ticker symbols and the corresponding company names for the values you provided:
AEFES: Anadolu Efes Biracılık ve Malt Sanayii A.Ş. AKBNK: Akbank T.A.Ş. AKSA: Aksa Akrilik Kimya Sanayii A.Ş. AKSEN: Aksa Enerji Üretim A.Ş. ALARK: Alarko Holding A.Ş. ALBRK: Albaraka Türk Katılım Bankası A.Ş. ANACM: Anadolu Cam Sanayii A.Ş. ARCLK: Arçelik A.Ş. ASELS: Aselsan Elektronik Sanayi ve Ticaret A.Ş. ASUZU: Asya Katılım Bankası A.Ş. AYGAZ: Aygaz A.Ş. BAGFS: Bagfas Bandırma Gübre Fabrikaları A.Ş. BANVT: Banvit Bandırma Vitaminli Yem Sanayii A.Ş. BRISA: Brisa Bridgestone Sabancı Lastik Sanayi ve Ticaret A.Ş. CCOLA: Coca-Cola İçecek A.Ş. CEMAS: Çemaş Döküm Sanayii A.Ş. ECILC: Eczacıbaşı İlaç, Kimya ve Plastik Sanayi A.Ş. EREGL: Ereğli Demir ve Çelik Fabrikaları T.A.Ş. FROTO: Ford Otomotiv Sanayi A.Ş. GARAN: Garanti BBVA Bankası A.Ş. GOODY: Goodyear Lastikleri T.A.Ş. GUBRF: Gübre Fabrikaları T.A.Ş. HALKB: Halkbank A.Ş. ICBCT: ICBC Turkey Bank A.Ş. ISCTR: Türkiye İş Bankası A.Ş. ISDMR: İş Dış Ticaret A.Ş. ISFIN: İş Finansal Kiralama A.Ş. ISYAT: İş Yatırım Menkul Değerler A.Ş. KAREL: Karel Elektronik Sanayi ve Ticaret A.Ş. KARSN: Kardemir Karabük Demir Çelik Sanayi ve Ticaret A.Ş. KCHOL: Koç Holding A.Ş. KRDMB: Kardemir Karabük Demir Çelik Sanayi ve Ticaret A.Ş. (B preferred shares) KRDMD: Kardemir Karabük Demir Çelik Sanayi ve Ticaret A.Ş. (D preferred shares) MGROS: Migros Ticaret A.Ş. OTKAR: Otokar Otomotiv ve Savunma Sanayi A.Ş. PARSN: Parsan Makina Parçaları Sanayii A.Ş. PETKM: Petkim Petrokimya Holding A.Ş. PGSUS: Pegasus Hava Taşımacılığı A.Ş. PRKME: Pınar Süt Mamülleri Sanayii A.Ş. SAHOL: Şişecam Camsanayi ve Ticaret A.Ş. SASA: Sasa Polyester Sanayi A.Ş. SISE: Şişe Cam Sanayi ve Ticaret A.Ş. SKBNK: Şekerbank T.A.Ş. SODA: Soda Sanayii A.Ş. TCELL: Türkcell İletişim Hizmetleri A.Ş. THYAO: Türk Hava Yolları A.O. TKFEN: Tekfen Holding A.Ş. TOASO: Türk Otomotiv Sanayi ve Ticaret A.Ş. TRKCM: Türk Telekomünikasyon A.Ş. TSKB: Türkiye Sınai Kalkınma Bankası A.Ş. TTKOM: Türk Telekomünikasyon A.Ş. (K preferred shares) TUKAS: Türk Traktör ve Ziraat Makineleri A.Ş. TUPRS: Tüpraş Türkiye Petrol Rafinerileri A.Ş. USAK: Ülker Bisküvi Sanayi A.Ş. VAKBN: Vakıflar Bankası T.A.O. VESTL: Vestel Elektronik Sanayi ve Ticaret A.Ş. YATAS: Yataş Yatak ve Yorgan Sanayi A.Ş. YKBNK: Yapı ve Kredi Bankası A.Ş. YUNSA: Yünsa Yünlü Sanayi ve Ticaret A.Ş. ZOREN: Zorlu Enerji Elektrik Üretim A.Ş. These are some of the companies that are listed on Borsa İstanbul, and the ticker symbols are used to identify and trade their stocks on the exchange. Please note that this is not an exhaustive list, and there may be more companies listed on the exchange with their respective ticker symbols.